/*
 * @Author: szx
 * @Date: 2022-01-12 13:39:42
 * @LastEditTime: 2022-01-12 13:47:28
 * @Description:
 * @FilePath: \leetcode\1-99\96\96.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var numTrees = function (n) {
    let dp = new Array(n + 1).fill(0);
    dp[0] = 1;
    dp[1] = 1;
    for (let i = 2; i <= n; i++) {
        for (let j = 1; j <= i; j++) {
            dp[i] += dp[j - 1] * dp[i - j];
        }
    }
    return dp[n];
};
